/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package practice.array;

import java.util.Scanner;

/**
 *
 * @author VANDH
 */
public class HotelManager {

    int count;
    Hotel[] hotelArray = new Hotel[10];

    public void inputHotels() {
        System.out.printf("Bao nhiêu khách sạn :");

        Scanner keyboard = new Scanner(System.in);
        count = keyboard.nextInt();

        if (count > 0 && count <= 10) {
            for (int i = 0; i < count; i++) {
                Hotel h = new Hotel();

                System.out.println("Nhập khách sạn thứ : " + (i + 1));
                h.inputHotel();
                hotelArray[i] = h;
            }
        } else {
            System.out.println("Số lượng không hợp lệ");
        }
    }

    public void showHotels() {
        for (int i = 0; i < count; i++) {
            hotelArray[i].showHotel();
        }
    }

    public void findHotel() {
        System.out.printf("Owner name : ");
        Scanner keyboard = new Scanner(System.in);
        String owner = keyboard.nextLine();

        for (int i = 0; i < count; i++) {
            if (hotelArray[i].ownerName.equals(owner)) {
                hotelArray[i].showHotel();
            }
        }
    }
}
